import http, {token} from './http';
import {CATEGORY_ITEM_URL, CATEGORY_LIST_URL} from './url.js'

const reqCategoryItems = (storeNo) => {
	return http({
		method: 'post',
		url: CATEGORY_ITEM_URL,
		data: {
			"appId": 1005,
			"apiVersion": "7.0",
			"isShowLoading": true,
			"userToken": token,
			"data": {
				"storeNo": storeNo,
				"channel": 1005
			}
		}
	}).then(res => {
		return res
	}).catch(err => {
		console.log('reqCategoryItems-err---', err)
	})
}

const reqCategoryList = (ctgId, tplId, page, storeNo) => {
	return http({
		method: 'post',
		url: CATEGORY_LIST_URL,
		data: {
			"appId": 1005,
			"apiVersion": "7.0",
			"isShowLoading": true,
			"userToken": token,
			"data": {
				"storeTemplateId": tplId, // 4650,
				"storeNo": storeNo,
				"categoryId": ctgId, // 719437,
				"sortType": 1,
				"pageSize": 10,
				"page": page ? page : 1
			}
		}
	}).then(res => {
		return res
	}).catch(err => {
		console.log('reqCategoryList-err---', err)
	})
}

export {reqCategoryItems, reqCategoryList}